
#LDWAY = EXECUTE
LDWAY = STATIC
#LDWAY = DYNAMIC

#TARGET := myheap
TARGET := libmyheap.a
#TARGET := libmyheap.so

INC := -I.

SRC := $(wildcard *.c)
OBJ := $(patsubst %.c, %.o, ${SRC})

CC := gcc
AR := ar
LD := ld
CCFLAG := ${INC}

#.PHONY: all clean

#all:

${TARGET} : ${OBJ}
ifeq ($(LDWAY), EXECUTE)
	${CC} ${CCFLAG} $^ -o $@
endif

ifeq ($(LDWAY), STATIC)
	${AR} -rc $@ $^
endif

ifeq ($(LDWAY), DYNAMIC)
	${CC} -fPIC -shared ${CCFLAG} $^ -o $@
endif


%.o : %.c
	${CC} ${CCFALG} -c $^ -o $@ 

clean:
	rm ${TARGET} ${OBJ}
